package com.lin.missyou.core.money;

import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * 银行家算法
 * @author gcq
 * @Create 2021-11-10
 */
public class HalfEvenRound implements IMoneyDiscout {

    @Override
    public BigDecimal discount(BigDecimal original, BigDecimal discount) {
        BigDecimal actualMoney = original.multiply(discount);
        BigDecimal finalMoney = actualMoney.setScale(2, RoundingMode.HALF_EVEN);
        return finalMoney;
    }
}